#include "World.h"

using namespace PHYOgre;

World::World(void)
	:mEntities()
	,mStepCount(0)
{
}


World::~World(void)
{
}

void World::Register(IntegrableInterface* iEntity)
{
	mEntities[iEntity] = iEntity;
}

void World::Unregister(IntegrableInterface* iEntity)
{
	EntityCollection::const_iterator target = mEntities.find(iEntity);
	mEntities.erase(target);
}

void World::RunStep(const Real& iDelta)
{
	for (EntityCollection::iterator it = mEntities.begin(); it != mEntities.end(); ++it)
	{
		it->second->Integrate(iDelta);
	}
	mStepCount +=1;
	
}
void World::UpdatePotentialContacts()
{

}
World::EntityCollectionConstIterator World::GetIteratorBegin() const
{
	return mEntities.begin();
}
World::EntityCollectionConstIterator World::GetIteratorEnd() const
{
	return mEntities.end();
}